import os
import shutil
import time
from Utils import *
file_path = os.path.abspath(__file__)
dir_path = os.path.dirname(file_path).replace("\\file","")
srcAssets = dir_path.replace("tools","")+'build\\jsb-default\\publish\\android'
print("apk路径::\n"+srcAssets)
if(os.path.exists(srcAssets)):
    copyFiles(srcAssets, dir_path)
    apk_path = get_files_list(dir_path)[0] 
    apk_name = os.path.basename(apk_path)
    apk_newname = time.strftime(get_files_xml_list(dir_path,'.xml')[0].replace('.xml','')+'_%Y%m%dydgb.apk',time.localtime(time.time()))
    if(os.path.exists(apk_newname)):
        os.remove(apk_newname)
    os.rename(apk_name, apk_newname)
shutil.rmtree(dir_path+'\\file\\__pycache__')
print('完成任务')